namespace mplat {
    export class WxOpenAbility extends OpenAbility {

        protected _share: WxShare;

        constructor() {
            super();
            this._share = new WxShare();
        }

        navigateToMiniProgram(param: INavigateParam) {
            if (wx["navigateToMiniProgram"] && param) {
                wx["navigateToMiniProgram"]({
                    appId: param.appId, path: param.page, success: () => {
                        // debug.writeLog(EnumLogType.gotoGame, appId);
                        if (!!param.success) param.success();
                    }, fail: () => {
                        if (!!param.fail) param.fail();
                    }
                });
            }
        }

        setShareFailTips(tips: IShowModalInfo[]) {
            this._share.setShareFailTips(tips);
        }
        setShareInfo(shareList: IShareInfo[], defaultShareIdx?: number, minTime?: number, minCount?: number) {
            this._share.setShareInfo(shareList, defaultShareIdx, minTime, minCount);
        }
        setShareDefaultData(data: any) {
            this._share.setShareDefaultData(data);
        }
        showShareMenu(withShareTicket?: boolean) {
            this._share.showShareMenu(withShareTicket);
        }
        shareAppMessage(param?: IShareInfo, data?: any, success?: () => void, fail?: () => void) {
            this._share.shareAppMessage(param, data, success, fail);
        }

        setShareDefaultComplete(success?: () => void, fail?: () => void, complete?: () => void) {
            this._share.setShareDefaultComplete(success, fail, complete);
        }
    }
}